//
//  FliterList.h
//  danpin
//
//  Created by chuangjia on 13/8/15.
//  Copyright (c) 2015 chuangjia. All rights reserved.
//

#import <UIKit/UIKit.h>


@protocol FliterListDataSource;
@protocol FliterListDelegate;

typedef NS_ENUM(NSInteger, FliterListIndicatorStyle) {
    FliterListIndicatorStyleBottomBar,           // Default
    FliterListIndicatorStyleButtonBorder
};

@interface FliterList : UIView

@property (nonatomic) NSInteger selectedButtonIndex;

@property (nonatomic, weak) id<FliterListDataSource> dataSource;
@property (nonatomic, weak) id<FliterListDelegate> delegate;

@property (nonatomic, strong) UIColor *selectionIndicatorColor;
@property (nonatomic, strong) UIColor *bottomTrimColor;

@property (nonatomic) UIEdgeInsets buttonInsets;

@property (nonatomic) FliterListIndicatorStyle selectionIndicatorStyle;

- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state;

- (void)reloadData;

@end

@protocol FliterListDataSource <NSObject>

- (NSInteger)numberOfItemsInSelectionList:(FliterList *)selectionList;
- (NSString *)selectionList:(FliterList *)selectionList titleForItemWithIndex:(NSInteger)index;
- (NSString *)selectionList:(FliterList *)selectionList imageNameForItemWithIndex:(NSInteger)index;
@end

@protocol FliterListDelegate <NSObject>

- (void)selectionList:(FliterList *)selectionList didSelectButtonWithIndex:(NSInteger)index;

@end